try:
    from .task import NominalTask, jsonify
except:
    from task import NominalTask, jsonify

class Workflow:
    def __init__(self, name: str, desc: str, tasks: list[NominalTask], fuse_direction: list[bool]):
        self.name = name
        self.desc = desc
        self.tasks = tasks
        self.fuse_direction = fuse_direction

    def jsonify(self):
        return {
            "name": self.name,
            "desc": self.desc,
            "tasks": [jsonify(task) for task in self.tasks],
            "fuse_direction": self.fuse_direction
        }
